package com.xuecheng.comment.convert;

import com.xuecheng.api.comment.model.dto.CommentDTO;
import com.xuecheng.api.comment.model.dto.ReplyDTO;
import com.xuecheng.comment.entity.Comment;
import com.xuecheng.comment.entity.Reply;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;
import org.mapstruct.factory.Mappers;

import java.util.List;

@Mapper
public interface ReplyConvert {
    ReplyConvert INSTANCE = Mappers.getMapper(ReplyConvert.class);

    @Mapping(source = "id", target = "replyId")
    ReplyDTO entity2dto(Reply entity);


    @Mappings({
            @Mapping(source = "replyId", target = "id")
    })
    Reply dto2entity(ReplyDTO dto);

    List<ReplyDTO> entitys2dtos(List<Reply> entitys);

}
